import Vue from 'vue'
import VueRouter from 'vue-router'
import my from '@/components/my'
import friend from '@/components/friend'
import find from '@/components/find'
import not404 from '@/components/not404'
import music from '@/components/music'

Vue.use(VueRouter)

const routes = [
  {
    path: '/', // 默认hash值路径
    redirect: '/find' // 重定向到/find
    // 浏览器url中#后的路径被改变成/find-重新匹配数组规则
  },
  {
    path: '/my',
    component: my

  },
  {
    path: '/friend',
    component: friend
  },
  {
    path: '/find',
    name: find,
    component: find
  },
  {
    path: '/music/:id',
    component: music
  },
  {
    path: '*',
    component: not404
  }
]

const router = new VueRouter({
  routes,
  mode: 'hash'
})

export default router
